//--------------------------------------------------------------------------------
// This file is a portion of the D2D1Renderer.  It is distributed
// under the MIT License, available in the root of this distribution and 
// at the following URL:
//
// http://www.opensource.org/licenses/mit-license.php
//
// Copyright (c) Mirco Timmermann
//
//--------------------------------------------------------------------------------
#pragma once

#ifndef _RECTANGLE_H
#define _RECTANGLE_H

#include <d3d11.h>

#ifndef _XM_NO_INTRINSICS_
#define _XM_NO_INTRINSICS_
#endif

#include <DirectXMath.h> //#include <xnamath.h>
using namespace DirectX; //#include <xnamath.h>

class Circle;
class Point2f;

class Rect {
public:
	Rect();
	Rect(float width, float height);
	Rect(float x, float y, float width, float height);
	~Rect(void);

	float _x;
	float _y;
	
	float _width;
	float _height;

	float Bottom(void);
	float Top(void);
	float Left(void);
	float Right(void);

	Point2f GetCenter();

	bool Intersect(Point2f point);
	bool Intersect(Rect rectangle);
	bool Intersect(Circle circle);

	Rect operator + (const Rect &r) const;
	Rect operator += (const Rect &r) const;

	//TODO: < > <= >= (Intersect) .... < beschreibt ob point innerhalb des Rectangle ist, > ob ausserhalb.
	bool operator < (const Point2f &p);
	bool operator > (const Point2f &p);

	bool operator <= (const Point2f &p);
	bool operator >= (const Point2f &p);

	void MakeHomogen();

};

#endif